
Q := @
CXX = g++

EIGEN_PATH := /usr/local/include/eigen3
PSLITE_PATH := ../

#INCLUDE := -I$(EIGEN_PATH)
INCLUDE := -I$(PSLITE_PATH)/include

TF_FLAGS := -I/home/seminelee/github/venv/lib/python3.6/site-packages/tensorflow_core/include -D_GLIBCXX_USE_CXX11_ABI=0
TF_LDFLAGS := -L/home/seminelee/github/venv/lib/python3.6/site-packages/tensorflow_core -l:libtensorflow_framework.so.1

CXXFLAGS := -std=c++11 -g $(INCLUDE)
LIBS := -lpslite -lpthread  -lzmq -lprotobuf -lleveldb 
LDFLAGS := -L$(PSLITE_PATH)/build -L$(PSLITE_PATH)/deps/lib

all: ps_server ps_push_pull_op.so

ps_server: main.cpp SGDServer.h
	$(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS) -I$(EIGEN_PATH) $(LIBS)

ps_push_pull_op.so: ps_push_pull_op.cc ps_ops.cc
	$(CXX) -c -o ps_ops.o ps_ops.cc -fPIC $(CXXFLAGS)
	$(CXX) -c -o ps_push_pull_op.o ps_push_pull_op.cc -fPIC $(CXXFLAGS)  $(TF_FLAGS) -I/home/seminelee/github/venv/lib/python3.6/site-packages/tensorflow_core/include/
	$(CXX) -shared ps_ops.o ps_push_pull_op.o -o $@ -fPIC  $(CXXFLAGS) $(TF_LDFLAGS) $(LDFLAGS) $(LIBS) 

clean:
	rm *.o
